import 'package:seedfour/app/models/case_invoice_entity.dart';
import 'package:seedfour/generated/json/base/json_field.dart';
import 'package:seedfour/generated/json/case_detail_entity.g.dart';
import 'dart:convert';

@JsonSerializable()
class CaseDetailEntity {
  CaseDetailInfo? caseInfo;
  List<CaseApproveRecord>? approveList;
  List<CaseContractFile>? contractFiles;
  List<CaseOrder>? orders;
  List<CaseOrder>? remitOrders;

  CaseDetailEntity();

  factory CaseDetailEntity.fromJson(Map<String, dynamic> json) =>
      $CaseDetailEntityFromJson(json);

  Map<String, dynamic> toJson() => $CaseDetailEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class CaseDetailInfo {
  String? id;
  String? createdAtStr;
  String? name;
  String? caseNameStr;
  String? caseName;
  String? caseTypeStr;
  String? caseStatus;
  String? caseDate;
  String? takerStr;
  String? suitType;
  String? lawsuitType;
  String? cico;
  String? clientName;
  String? clientCode;
  String? oppositeName;
  String? oppositeCode;
  String? thirdName;
  String? thirdCode;
  String? archive;

  bool? isSignedContract;

  CaseDetailInfo();

  factory CaseDetailInfo.fromJson(Map<String, dynamic> json) =>
      $CaseDetailInfoFromJson(json);

  Map<String, dynamic> toJson() => $CaseDetailInfoToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class CaseApproveRecord {
  int? createdAt;
  int? updatedAt;
  int? id;
  String? caseId;
  String? uid;
  int? type;
  int? approve;
  String? remark;
  String? approverName;

  CaseApproveRecord();

  factory CaseApproveRecord.fromJson(Map<String, dynamic> json) =>
      $CaseApproveRecordFromJson(json);

  Map<String, dynamic> toJson() => $CaseApproveRecordToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class CaseContractFile {
  int? id;
  String? desc;
  String? name;

  CaseContractFile();

  factory CaseContractFile.fromJson(Map<String, dynamic> json) =>
      $CaseContractFileFromJson(json);

  Map<String, dynamic> toJson() => $CaseContractFileToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class CaseOrder {
  String? id;
  String? title;
  int? createdAt;
  int? orderPayStatus;
  int? orderChargeStatus;
  String? orderChannelType;
  int? orderAmount;
  int? marginAmount;
  String? agentUid;
  int? collectionDate;
  String? agentUsername;
  String? invoice;
  String? createdAtStr;
  String? collectionDateStr;
  String? orderAmountStr;
  String? marginAmountStr;

  CaseInvoiceEntity? invoiceInfo;

  CaseOrder();

  factory CaseOrder.fromJson(Map<String, dynamic> json) =>
      $CaseOrderFromJson(json);

  Map<String, dynamic> toJson() => $CaseOrderToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
